<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
	<title>Explain data frame analytics API | ElasticSearch 7.7 权威指南中文版</title>
	<meta name="keywords" content="ElasticSearch 权威指南中文版, elasticsearch 7, es7, 实时数据分析，实时数据检索" />
    <meta name="description" content="ElasticSearch 权威指南中文版, elasticsearch 7, es7, 实时数据分析，实时数据检索" />
    <!-- Give IE8 a fighting chance -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
	<link rel="stylesheet" type="text/css" href="../static/styles.css" />
	<script>
	var _link = 'explain-dfanalytics.html';
    </script>
</head>
<body>
<div class="main-container">
    <section id="content">
        <div class="content-wrapper">
            <section id="guide" lang="zh_cn">
                <div class="container">
                    <div class="row">
                        <div class="col-xs-12 col-sm-8 col-md-8 guide-section">
                            <div style="color:gray; word-break: break-all; font-size:12px;">原英文版地址: <a href="https://www.elastic.co/guide/en/elasticsearch/reference/7.7/explain-dfanalytics.html" rel="nofollow" target="_blank">https://www.elastic.co/guide/en/elasticsearch/reference/7.7/explain-dfanalytics.html</a>, 原文档版权归 www.elastic.co 所有<br/>本地英文版地址: <a href="../en/explain-dfanalytics.html" rel="nofollow" target="_blank">../en/explain-dfanalytics.html</a></div>
                        <!-- start body -->
                  <div class="page_header">
<strong>重要</strong>: 此版本不会发布额外的bug修复或文档更新。最新信息请参考 <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html" rel="nofollow">当前版本文档</a>。
</div>
<div id="content">
<div class="breadcrumbs">
<span class="breadcrumb-link"><a href="index.html">Elasticsearch Guide [7.7]</a></span>
»
<span class="breadcrumb-link"><a href="rest-apis.html">REST APIs</a></span>
»
<span class="breadcrumb-link"><a href="ml-df-analytics-apis.html">Machine learning data frame analytics APIs</a></span>
»
<span class="breadcrumb-node">Explain data frame analytics API</span>
</div>
<div class="navheader">
<span class="prev">
<a href="evaluate-dfanalytics.html">« Evaluate data frame analytics API</a>
</span>
<span class="next">
<a href="get-dfanalytics.html">Get data frame analytics jobs API »</a>
</span>
</div>
<div class="section xpack">
<div class="titlepage"><div><div>
<h2 class="title">
<a id="explain-dfanalytics"></a>Explain data frame analytics API<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/ml/df-analytics/apis/explain-dfanalytics.asciidoc">edit</a><a class="xpack_tag" href="https://www.elastic.co/subscriptions"></a>
</h2>
</div></div></div>

<p>Explains a data frame analytics config.</p>
<div class="warning admon">
<div class="icon"></div>
<div class="admon_content">
<p>This functionality is experimental and may be changed or removed completely in a future release. Elastic will take a best effort approach to fix any issues, but experimental features are not subject to the support SLA of official GA features.</p>
</div>
</div>
<div class="section">
<div class="titlepage"><div><div>
<h3 class="title">
<a id="ml-explain-dfanalytics-request"></a>Request<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/ml/df-analytics/apis/explain-dfanalytics.asciidoc">edit</a>
</h3>
</div></div></div>
<p><code class="literal">GET _ml/data_frame/analytics/_explain</code><br></p>
<p><code class="literal">POST _ml/data_frame/analytics/_explain</code><br></p>
<p><code class="literal">GET _ml/data_frame/analytics/&lt;data_frame_analytics_id&gt;/_explain</code><br></p>
<p><code class="literal">POST _ml/data_frame/analytics/&lt;data_frame_analytics_id&gt;/_explain</code></p>
</div>

<div class="section">
<div class="titlepage"><div><div>
<h3 class="title">
<a id="ml-explain-dfanalytics-prereq"></a>Prerequisites<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/ml/df-analytics/apis/explain-dfanalytics.asciidoc">edit</a>
</h3>
</div></div></div>
<p>If the Elasticsearch security features are enabled, you must have the following privileges:</p>
<div class="ulist itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
cluster: <code class="literal">monitor_ml</code>
</li>
</ul>
</div>
<p>For more information, see <a class="xref" href="security-privileges.html" title="Security privileges">Security privileges</a> and <a class="xref" href="built-in-roles.html" title="Built-in roles">Built-in roles</a>.</p>
</div>

<div class="section">
<div class="titlepage"><div><div>
<h3 class="title">
<a id="ml-explain-dfanalytics-desc"></a>Description<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/ml/df-analytics/apis/explain-dfanalytics.asciidoc">edit</a>
</h3>
</div></div></div>
<p>This API provides explanations for a data frame analytics config that either
exists already or one that has not been created yet.
The following explanations are provided:</p>
<div class="ulist itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
which fields are included or not in the analysis and why,
</li>
<li class="listitem">
how much memory is estimated to be required. The estimate can be used when
deciding the appropriate value for <code class="literal">model_memory_limit</code> setting later on.
</li>
</ul>
</div>
<p>If you have object fields or fields that are excluded via source filtering,
they are not included in the explanation.</p>
</div>

<div class="section">
<div class="titlepage"><div><div>
<h3 class="title">
<a id="ml-explain-dfanalytics-path-params"></a>Path parameters<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/ml/df-analytics/apis/explain-dfanalytics.asciidoc">edit</a>
</h3>
</div></div></div>
<div class="variablelist">
<dl class="variablelist">
<dt>
<span class="term">
<code class="literal">&lt;data_frame_analytics_id&gt;</code>
</span>
</dt>
<dd>
(Optional, string)
Identifier for the data frame analytics job.
</dd>
</dl>
</div>
</div>

<div class="section">
<div class="titlepage"><div><div>
<h3 class="title">
<a id="ml-explain-dfanalytics-request-body"></a>Request body<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/ml/df-analytics/apis/explain-dfanalytics.asciidoc">edit</a>
</h3>
</div></div></div>
<p>A data frame analytics config as described in <a class="xref" href="put-dfanalytics.html" title="Create data frame analytics jobs API">Create data frame analytics jobs</a>.
Note that <code class="literal">id</code> and <code class="literal">dest</code> don’t need to be provided in the context of this API.</p>
</div>

<div class="section child_attributes">
<div class="titlepage"><div><div>
<h3 class="title">
<a id="ml-explain-dfanalytics-results"></a>Response body<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/ml/df-analytics/apis/explain-dfanalytics.asciidoc">edit</a>
</h3>
</div></div></div>
<p>The API returns a response that contains the following:</p>
<div class="variablelist">
<dl class="variablelist">
<dt>
<span class="term">
<code class="literal">field_selection</code>
</span>
</dt>
<dd>
<p>
(array)
An array of objects that explain selection for each field, sorted by
the field names.
</p>
<details open>
<summary class="title">Properties of <code class="literal">field_selection</code> objects</summary>
<div class="content">
<div class="variablelist">
<dl class="variablelist">
<dt>
<span class="term">
<code class="literal">is_included</code>
</span>
</dt>
<dd>
(boolean) Whether the field is selected to be included in the analysis.
</dd>
<dt>
<span class="term">
<code class="literal">is_required</code>
</span>
</dt>
<dd>
(boolean) Whether the field is required.
</dd>
<dt>
<span class="term">
<code class="literal">feature_type</code>
</span>
</dt>
<dd>
(string) The feature type of this field for the analysis. May be <code class="literal">categorical</code>
or <code class="literal">numerical</code>.
</dd>
<dt>
<span class="term">
<code class="literal">mapping_types</code>
</span>
</dt>
<dd>
(string) The mapping types of the field.
</dd>
<dt>
<span class="term">
<code class="literal">name</code>
</span>
</dt>
<dd>
(string) The field name.
</dd>
<dt>
<span class="term">
<code class="literal">reason</code>
</span>
</dt>
<dd>
(string) The reason a field is not selected to be included in the analysis.
</dd>
</dl>
</div>
</div>
</details>
</dd>
<dt>
<span class="term">
<code class="literal">memory_estimation</code>
</span>
</dt>
<dd>
<p>
(object)
An object containing the memory estimates.
</p>
<details open>
<summary class="title">Properties of <code class="literal">memory_estimation</code></summary>
<div class="content">
<div class="variablelist">
<dl class="variablelist">
<dt>
<span class="term">
<code class="literal">expected_memory_with_disk</code>
</span>
</dt>
<dd>
(string) Estimated memory usage under the assumption that overflowing to disk is
allowed during data frame analytics. <code class="literal">expected_memory_with_disk</code> is usually smaller
than <code class="literal">expected_memory_without_disk</code> as using disk allows to limit the main
memory needed to perform data frame analytics.
</dd>
<dt>
<span class="term">
<code class="literal">expected_memory_without_disk</code>
</span>
</dt>
<dd>
(string) Estimated memory usage under the assumption that the whole
data frame analytics should happen in memory (i.e. without overflowing to disk).
</dd>
</dl>
</div>
</div>
</details>
</dd>
</dl>
</div>
</div>

<div class="section">
<div class="titlepage"><div><div>
<h3 class="title">
<a id="ml-explain-dfanalytics-example"></a>Examples<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/ml/df-analytics/apis/explain-dfanalytics.asciidoc">edit</a>
</h3>
</div></div></div>
<div class="pre_wrapper lang-console">
<pre class="programlisting prettyprint lang-console">POST _ml/data_frame/analytics/_explain
{
  "source": {
    "index": "houses_sold_last_10_yrs"
  },
  "analysis": {
    "regression": {
      "dependent_variable": "price"
    }
  }
}</pre>
</div>
<div class="console_widget" data-snippet="snippets/1856.console"></div>
<p>The API returns the following results:</p>
<div class="pre_wrapper lang-console-result">
<pre class="programlisting prettyprint lang-console-result">{
  "field_selection": [
    {
      "field": "number_of_bedrooms",
      "mappings_types": ["integer"],
      "is_included": true,
      "is_required": false,
      "feature_type": "numerical"
    },
    {
      "field": "postcode",
      "mappings_types": ["text"],
      "is_included": false,
      "is_required": false,
      "reason": "[postcode.keyword] is preferred because it is aggregatable"
    },
    {
      "field": "postcode.keyword",
      "mappings_types": ["keyword"],
      "is_included": true,
      "is_required": false,
      "feature_type": "categorical"
    },
    {
      "field": "price",
      "mappings_types": ["float"],
      "is_included": true,
      "is_required": true,
      "feature_type": "numerical"
    }
  ],
  "memory_estimation": {
    "expected_memory_without_disk": "128MB",
    "expected_memory_with_disk": "32MB"
  }
}</pre>
</div>
</div>

</div>
<div class="navfooter">
<span class="prev">
<a href="evaluate-dfanalytics.html">« Evaluate data frame analytics API</a>
</span>
<span class="next">
<a href="get-dfanalytics.html">Get data frame analytics jobs API »</a>
</span>
</div>
</div>

                  <!-- end body -->
                        </div>
                        <div class="col-xs-12 col-sm-4 col-md-4" id="right_col">
                        
                        </div>
                    </div>
                </div>
            </section>
        </div>
    </section>
</div>
<script src="../static/cn.js"></script>
</body>
</html>